home *** CD-ROM | disk | FTP | other *** search
/ El Mac 1 / Magazine.iso / EL MAC 1 / Shareware / HyperCard / XCMD Docs / CompileIt! Source Code / CopyBitsXCMD num < prev    next >
Encoding:
Text File  |  1995-08-20  |  866 b   |  27 lines  |  [TEXT/ttxt]

  1. global rect1:R[8],rect2:R
  2. on CopyBitsXCMD num
  3.   GetGWorld oldPort,oldDev
  4.   put NewGworld(myGWorld,8,oldPort@.portRect,NIL,NIL,0) into myErr
  5.   if myErr≠0 then
  6.     sysBeep 10
  7.     answer "An error occured in the XCMD. NewGworld failed. ID=" & myErr
  8.     exit CopyBitsXCMD
  9.   end if
  10.   SetGWorld myGWorld,NIL
  11.   put GetGWorldPixMap(myGWorld) into pixMapHandle
  12.   put LockPixels(pixMapHandle) into myErr
  13.   if myErr=1 then
  14.     eraseRect rect1
  15.     copyBits oldPort@.portBits,myGWorld@.portBits,oldPort@.portRect,oldPort@.portRect,0,nil
  16.     SetGWorld oldPort,OldDev
  17.     copyBits myGWorld@.portBits,oldPort@.portBits,oldPort@.portRect,oldPort@.portRect,num,nil
  18.   else
  19.     sysBeep 10
  20.     answer "An error occured in the XCMD. LockPixels failed. Returned false."
  21.     exit CopyBitsXCMD
  22.   end if
  23.   unlockPixels pixMapHandle
  24.   SetPort oldPort
  25.   DisposeGWorld myGWorld
  26. end CopyBitsXCMD
  27.